<?php
class user extends base{

	public function init(){ // 公用
		parent::init(); // 这是必须的

		$this->tit = '用户';
		$this->modelObj = D('company_user');
	}

    //列表
	public function index(){
		/*分类切换*/
		$this->tabtit = array('全部','禁用');

		$cond = "1=1 and avatarUrl != '' ".$this->cond_base;

		//加入查询条件
		switch($this->tab){
			case '1':
				$cond .=" and status=0";
				break;
			default:
				$cond .=" and status=1";
		}
		//搜索
		if($this->keyword){
			$cond.=" and (nickname like '%".$this->keyword."%') ";
		}

		$result = $this->modelObj->get_pagelist($cond,'','*');
        if($result){
        	// $this->roles = $this->roleObj->ids($result['list'],'role_id');

        	$this->list = $result['list'];
			$this->showPage = $result['showPage'];
			$this->total = $result['total'];
		}
	}

	//列表
	public function list(){

		$this->layout = "";

		$this->tabtit = array('全部','回收站');
		$cond = "1=1".$this->cond_base;
		//加入查询条件
		switch($this->tab){
			case '1':
				$cond .=" and status=0";
				break;
			default:
				$cond .=" and status=1";
		}
		//搜索
		if($this->keyword){
			$cond.=" and (nickName like '%".$this->keyword."%') ";
		}

		$result = $this->modelObj->getList($cond);
		// dump($result);exit;
		if($result){
			// $this->companys = $this->companyObj->ids($result['list'],'company_id');

			$this->list = $result['list'];
			$this->showPage = $result['showPage'];
			$this->total = $result['total'];
		}

	}

}